﻿// -------------------------------------------------------------------------
//    @FileName         :    NFCreditPart.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFCreditPart
//
// -------------------------------------------------------------------------

#include "NFCreditPart.h"

#include "proto_db.pb.h"

NFCreditPart::NFCreditPart()
{
    if (EN_OBJ_MODE_INIT == NFShmMgr::Instance()->GetCreateMode())
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFCreditPart::~NFCreditPart()
{
}

int NFCreditPart::CreateInit()
{
    return 0;
}
    
int NFCreditPart::ResumeInit()
{
    return 0;
}

int NFCreditPart::LoadFromDB(const proto_ff::tbRoleDetail *pDBData)
{
    m_stData.FromPb(pDBData->role_play_data().credit_data());
    return 0;
}

int NFCreditPart::InitConfig(proto_ff::tbRoleDetail *pDbData, const RoleOne &stRoleOne)
{
    auto pRoleCreditData = pDbData->mutable_role_play_data()->mutable_credit_data();
    CHECK_NULL(0, pRoleCreditData);

    pRoleCreditData->set_is_inited(true);
    pRoleCreditData->set_next_can_play_time(0);
    pRoleCreditData->set_last_check_recover_time(NF_ADJUST_TIMENOW_MS());
    pRoleCreditData->set_can_punish_point_recover(false);
    pRoleCreditData->set_next_can_match_time(0);

    return 0;
}

int NFCreditPart::SaveDB(proto_ff::tbRoleDetail *pDBData)
{
    m_stData.ToPb(pDBData->mutable_role_play_data()->mutable_credit_data());
    return 0;
}

int NFCreditPart::MakePlayerDataCS(proto_ff::Proto_CSGetRoleRsp* pCSGetRoleRsp)
{
    return 0;
}

int NFCreditPart::MakeCityPlayerData(proto_ff::CityRoleInfo* pGCCityRoleInfo)
{
    return 0;
}
